<%@page contentType="text/html;charset=utf-8" pageEncoding="UTF-8" %>
<%@page import="org.ipo.mm.web.util.ConstantManager, java.util.Collection, org.ipo.mm.web.util.security.SecurityManager, org.ipo.mm.ejb.entities.Meeting" %>
<%@taglib prefix="h" uri="http://struts.apache.org/tags-html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="l" uri="http://struts.apache.org/tags-logic" %>
<%@ taglib prefix="b" uri="http://struts.apache.org/tags-bean" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>  

<%--
    prenosim naziv i vrednost parametra 'method' da bi se moglo prikazati submit dugme koje se gubi pri vaidaciji :)

--%>
<%
            Collection<Integer> privileges = (Collection<Integer>) request.getSession().getAttribute(ConstantManager.SESSION_USER_PRIVILEGES);%>
<script type="text/javascript">

    function openInNewWindow() {
        window.open(arguments[0],'Test' ,"menubar=yes,width=923,height=400,toolbar=no");
    }
    function start(){
        switchMenu('file2');
        switchMenu('file3');
        switchMenu('file4');
        switchMenu('file5');
        switchMenu('file6');
        switchMenu('file7');
        switchMenu('file8');
        switchMenu('file9');
        switchMenu('file10');
        switchMenu('file11');
        switchMenu('file12');
        switchMenu('file13');
        switchMenu('file14');
        switchMenu('file15');
        switchMenu('file16');
        switchMenu('file17');
        switchMenu('file18');
        switchMenu('file19');
        switchMenu('file20');
        switchMenu('file21');
        switchMenu('file22');
        switchMenu('file23');
        switchMenu('file24');
        switchMenu('file25');
        switchMenu('file26');
        switchMenu('file27');
        switchMenu('file28');
        switchMenu('file29');
        switchMenu('file30');

        switchMenu('allResults');
    }
</script>


<h1><%=request.getSession().getAttribute("title")%></h1>
<div>
    <h:form action="/protected/meeting?&method=${param['method']}&rf=false" enctype="multipart/form-data">
        <div class="create">
            <table width="100%" border="0" >

                <tr class="red1" style="border-top-color:black; border-top-style:solid;">
                    <td><span class="title"><b:message key="meetings_meeting_info"/></span></td>
                    <td></td>
                </tr>

                <tr>
                    <td><span class="important"><b:message key="meetings_event_name"/></span></td>
                    <td><h:text property="eventName" size="100" maxlength="512"/></td>
                </tr>
                <tr>
                    <td><span class="important"><b:message key="meetings_date"/>(dd/mm/yyyy)</span></td>
                    <td>
                        <h:text styleId="date" property="date" /><button type="button" id="dateButton">...</button>
                        <script type="text/javascript">//<![CDATA[

                            var cal = Calendar.setup({
                                onSelect: function(cal) { cal.hide() },
                                selectionType : Calendar.SEL_SINGLE


                            });
                            //cal.manageFields("dateButton", "date", "%d/%m/%Y %H:%M");
                            cal.manageFields("dateButton", "date", "%d/%m/%Y");

                            //]]></script>
                        <b:message key="meetings_date_start_time"/>
                        <h:select property="startTime">
                            <h:option value="00:00">00:00</h:option>
                            <h:option value="00:30">00:30</h:option>
                            <h:option value="01:00">01:00</h:option>
                            <h:option value="01:30">01:30</h:option>
                            <h:option value="02:00">02:00</h:option>
                            <h:option value="02:30">02:30</h:option>
                            <h:option value="03:00">03:00</h:option>
                            <h:option value="03:30">03:30</h:option>
                            <h:option value="04:00">04:00</h:option>
                            <h:option value="04:30">04:30</h:option>
                            <h:option value="05:00">05:00</h:option>
                            <h:option value="05:30">05:30</h:option>
                            <h:option value="06:00">06:00</h:option>
                            <h:option value="06:30">06:30</h:option>
                            <h:option value="07:00">07:00</h:option>
                            <h:option value="07:30">07:30</h:option>
                            <h:option value="08:00">08:00</h:option>
                            <h:option value="08:30">08:30</h:option>
                            <h:option value="09:00">09:00</h:option>
                            <h:option value="09:30">09:30</h:option>
                            <h:option value="10:00">10:00</h:option>
                            <h:option value="10:30">10:30</h:option>
                            <h:option value="11:00">11:00</h:option>
                            <h:option value="11:30">11:30</h:option>
                            <h:option value="12:00">12:00</h:option>
                            <h:option value="12:30">12:30</h:option>
                            <h:option value="13:00">13:00</h:option>
                            <h:option value="13:30">13:30</h:option>
                            <h:option value="14:00">14:00</h:option>
                            <h:option value="14:30">14:30</h:option>
                            <h:option value="15:00">15:00</h:option>
                            <h:option value="15:30">15:30</h:option>
                            <h:option value="16:00">16:00</h:option>
                            <h:option value="16:30">16:30</h:option>
                            <h:option value="17:00">17:00</h:option>
                            <h:option value="17:30">17:30</h:option>
                            <h:option value="18:00">18:00</h:option>
                            <h:option value="18:30">18:30</h:option>
                            <h:option value="19:00">19:00</h:option>
                            <h:option value="19:30">19:30</h:option>
                            <h:option value="20:00">20:00</h:option>
                            <h:option value="20:30">20:30</h:option>
                            <h:option value="21:00">21:00</h:option>
                            <h:option value="21:30">21:30</h:option>
                            <h:option value="22:00">22:00</h:option>
                            <h:option value="22:30">22:30</h:option>
                            <h:option value="23:00">23:00</h:option>
                            <h:option value="23:30">23:30</h:option>
                        </h:select>
                        <b:message key="meetings_date_end_time"/>
                        <h:select property="endTime">
                            <h:option value="00:00">00:00</h:option>
                            <h:option value="00:30">00:30</h:option>
                            <h:option value="01:00">01:00</h:option>
                            <h:option value="01:30">01:30</h:option>
                            <h:option value="02:00">02:00</h:option>
                            <h:option value="02:30">02:30</h:option>
                            <h:option value="03:00">03:00</h:option>
                            <h:option value="03:30">03:30</h:option>
                            <h:option value="04:00">04:00</h:option>
                            <h:option value="04:30">04:30</h:option>
                            <h:option value="05:00">05:00</h:option>
                            <h:option value="05:30">05:30</h:option>
                            <h:option value="06:00">06:00</h:option>
                            <h:option value="06:30">06:30</h:option>
                            <h:option value="07:00">07:00</h:option>
                            <h:option value="07:30">07:30</h:option>
                            <h:option value="08:00">08:00</h:option>
                            <h:option value="08:30">08:30</h:option>
                            <h:option value="09:00">09:00</h:option>
                            <h:option value="09:30">09:30</h:option>
                            <h:option value="10:00">10:00</h:option>
                            <h:option value="10:30">10:30</h:option>
                            <h:option value="11:00">11:00</h:option>
                            <h:option value="11:30">11:30</h:option>
                            <h:option value="12:00">12:00</h:option>
                            <h:option value="12:30">12:30</h:option>
                            <h:option value="13:00">13:00</h:option>
                            <h:option value="13:30">13:30</h:option>
                            <h:option value="14:00">14:00</h:option>
                            <h:option value="14:30">14:30</h:option>
                            <h:option value="15:00">15:00</h:option>
                            <h:option value="15:30">15:30</h:option>
                            <h:option value="16:00">16:00</h:option>
                            <h:option value="16:30">16:30</h:option>
                            <h:option value="17:00">17:00</h:option>
                            <h:option value="17:30">17:30</h:option>
                            <h:option value="18:00">18:00</h:option>
                            <h:option value="18:30">18:30</h:option>
                            <h:option value="19:00">19:00</h:option>
                            <h:option value="19:30">19:30</h:option>
                            <h:option value="20:00">20:00</h:option>
                            <h:option value="20:30">20:30</h:option>
                            <h:option value="21:00">21:00</h:option>
                            <h:option value="21:30">21:30</h:option>
                            <h:option value="22:00">22:00</h:option>
                            <h:option value="22:30">22:30</h:option>
                            <h:option value="23:00">23:00</h:option>
                            <h:option value="23:30">23:30</h:option>
                        </h:select>

                        <span class="error" ><h:errors property="date" /></span>
                    </td>

                </tr>
                <tr style="border-bottom-color:black; border-bottom-style:solid;">
                    <td><b:message key="meetings_venue"/></td>
                    <td><h:text property="venue" size="100" maxlength="512"/></td>
                </tr>

                <tr class="red1">
                    <td><span class="title"><b:message key="meetings_people"/></span></td>
                    <td></td>
                </tr>

                <tr >
                    <td><span class="important"><b:message key="meetings_organizer"/></span></td>
                    <td>
                        <c:choose>
                            <c:when test="${not empty MEETING_PROCESS.organizer}">
                                ${MEETING_PROCESS.organizer.lastName} ${MEETING_PROCESS.organizer.firstName}
                                ${MEETING_PROCESS.organizer.institution.name}
                            </c:when>
                            <c:otherwise>
                                <b:message key="meetings_not_selected"/>
                            </c:otherwise>
                        </c:choose>

                        <span class="error" ><h:errors property="organizer" /></span>
                    </td>
                </tr>
                <tr >
                    <td><span class="important"><b:message key="meetings_participants"/></span></td>
                    <td>
                        <%-- if there are no particiapnts label is renderd --%>
                        <%
            if (((Meeting) request.getSession().getAttribute(ConstantManager.SESSION_MEETING_PROCESS_AN)).getRepresentativeCollection().isEmpty()) {

                        %>
                        <b:message key="meetings_not_selected"/>
                        <%}%>




                        <l:iterate id="repr" name="MEETING_PROCESS" property="representativeCollection">
                            <h:multibox property="selectedReprForRemove">
                                <b:write name="repr" property="id" />
                            </h:multibox>
                            <%--
                            <c:choose>
                                <c:when test="${repr.user == USER}">
                                    <h:link action="/protected/dispatch?method=showUpdateReprForm"
                                            paramId="rid" paramName="repr" paramProperty="id">
                                        <b:write name="repr" property="firstName"/>
                                        <b:write name="repr" property="lastName"/>
                                    </h:link>
                                </c:when>

                                <c:otherwise>
                                    <b:write name="repr" property="firstName"/>
                                    <b:write name="repr" property="lastName"/>
                                </c:otherwise>
                            </c:choose>


                            <c:choose>
                                <c:when test="${repr.institution.user == USER}">
                                    <h:link action="/protected/dispatch?method=showUpdateInstForm?iid=${repr.institution.id}">
                                        ${repr.institution.name}</h:link>
                                        <br/>
                                </c:when>

                                <c:otherwise>
                                    ${repr.institution.name}
                                </c:otherwise>
                            </c:choose>
                            --%>
                            <b:write name="repr" property="firstName"/>
                            <b:write name="repr" property="lastName"/>
                            ${repr.institution.name}
                            <br/>
                        </l:iterate>

                        <!-- dugme za ukljanjanje predstavnika iz liste sastanak se prikazuje samo ako lista ima elemenata -->
                        <%
            Collection representatives = ((Meeting) request.getSession().getAttribute(ConstantManager.SESSION_MEETING_PROCESS_AN)).getRepresentativeCollection();
            if (representatives.size() > 0) {
                        %>
                        <h:submit property="operation"><b:message key="meetings_remove_repr" /></h:submit>
                        <%}%>


                    </td>
                </tr>
                <tr >
                    <td><b:message key="meetings_search_participants"/></td>
                    <td><h:text property="searchQuery" /> <h:submit property="operation"><b:message key="meetings_search_repr"/></h:submit><br>
                        <l:notEmpty name="MeetingBean" property="reprSearchResults">
                            <b:message key="meetings_search_participants_results"/>:
                        </l:notEmpty>

                        <l:iterate id="sresult" name="MeetingBean" property="reprSearchResults" indexId="i">
                            <c:if test="${i == 10}">
                                <button type="button" onclick="switchMenu('allResults');"><b:message key="meetings_search_participants_see_all_results"/></button>
                                <div id="allResults">
                                </c:if>
                                <br />
                                <h:multibox property="selectedRepresentatives">
                                    <b:write name="sresult" property="id"/>
                                </h:multibox>
                                <b:write name="sresult" property="lastName" />
                                <b:write name="sresult" property="firstName" />,
                                ${sresult.institution.name}
                                <c:if test="${fn:length(reprSearchResults) == i+1}">
                                </div>
                            </c:if>

                        </l:iterate>
                    </td>
                </tr>
                <tr >
                    <td><b:message key="meetings_participants_select_role"/></td>
                    <td>
                        <l:notEmpty name="MeetingBean" property="reprSearchResults">
                            <h:radio property="role" value="Representative" /> <b:message key="meetings_participant_role"/>
                            <br>
                            <h:radio property="role" value="Organizer" /> <b:message key="meetings_organizer_role"/>
                            <br>
                            <h:submit property="operation">
                                <b:message key="meetings_add_repr" />
                            </h:submit>
                        </l:notEmpty>
                    </td>
                </tr>
                <tr style="border-bottom-color:black; border-bottom-style:solid;">
                    <td></td>
                    <td>
                        <h:submit property="operation">
                            <b:message key="repr_create"/>
                        </h:submit>
                    </td>
                </tr>
                <tr class="red1">
                    <td><span class="title"><b:message key="meetings_meeting_data"/></span></td>
                    <td></td>
                </tr>
                <tr style="border-bottom-color:black; border-bottom-style:solid;">
                    <td><b:message key="meetings_minutes"/></td>
                    <td><h:textarea cols="100" rows="30" property="conclusion" style="background-color: #DDDDDD"/></td>
                </tr>
                <tr style="border-bottom-color:black; border-bottom-style:solid;"h:text>
                    <td><a name="actions"/><b:message key="meetings_actions"/></td>
                    <td>

                        <script type="text/javascript">//<![CDATA[

                            var cal = Calendar.setup({
                                onSelect: function(cal) { cal.hide() }

                            });
                            cal.manageFields("actionDateButton", "actionDate", "%d/%m/%Y");

                            //]]></script>



                        <script type="text/javascript">
                            function dodajAkciju(){
                                if(!document.getElementById("actionName").value == "" && !document.getElementById("actionAction").value == ""){
                                    document.getElementById("actions").value = document.getElementById("actions").value  +
                                        document.getElementById("actionName").value+"|"+
                                        document.getElementById("actionAction").value+"|"+
                                        document.getElementById("actionDate").value+ "\n";
                                    document.getElementById("actionName").value = "";
                                    document.getElementById("actionAction").value = "";
                                    document.getElementById("actionDate").value = "";
                                }
                            }
                        </script>

                        <br />
                        <div class="tabelaNova">
                        <table >

                            <tr>
                                <th scope="col" style="background-color: #F2F2F2; color:#6589AB;"><b:message key="meetings_action_action"/></th>
                                <th scope="col" style="background-color: #F2F2F2; color:#6589AB;"><b:message key="meetings_action_name"/></th>
                                <th scope="col" style="background-color: #F2F2F2; color:#6589AB;"><b:message key="meetings_action_status"/></th>
                                <th scope="col" style="background-color: #F2F2F2; color:#6589AB;"><b:message key="meetings_action_due_date"/></th>
                                <th scope="col" style="background-color: #F2F2F2; color:#6589AB;" nowrap="true"></th>
                            </tr>
                            <%--<c:if test="${param['method'] == 'showCreateMeetingForm'}">--%>


                            <l:iterate id="meetingActions" name="MEETING_PROCESS" property="meetingActions">
                                <!--<tr style="border-bottom: black; border-width: 1px; border-style: dotted">-->
                                <tr style="border-bottom-width: thin;border-bottom-style: solid;border-bottom-color: #000000;">

                                    <td>

                                        <b:write name="meetingActions" property="actionText"/>
                                    </td>
                                    <td>

                                        <b:write name="meetingActions" property="name"/>
                                    </td>
                                    <td>

                                        <c:choose>
                                            <c:when test="${meetingActions.status == 'FINISHED'}">
                                                <b:message key="actions_finished" />
                                            </c:when>

                                            <c:when test="${meetingActions.status == 'PENDING'}">
                                                <b:message key="actions_pending" />
                                            </c:when>

                                        </c:choose>


                                    </td>
                                    <td>

                                        <b:write name="meetingActions" property="dueDate" format="dd/MM/yyyy"/>
                                    </td>
                                    <td nowrap="true">

                                        <c:if test="${not empty meetingActions.id}">


                                        <%
              if (privileges.contains(SecurityManager.EDIT_ACTIONS_PRIVILEGE)) {
                                        %>
                                        <a href="javascript:openInNewWindow('dispatch.do?method=showUpdateActionsForm&aid=${meetingActions.id}');"><b:message key="gen_update"/></a>
                                        <%}%>


                                        <%
                            if (privileges.contains(SecurityManager.DELETE_ACTIONS_PRIVILEGE)) {
                                        %>
                                        <h:link action="/protected/dispatch?method=deleteActions&aid=${meetingActions.id}"><b:message key="gen_delete"/></h:link>
                                        <%}%>

                                        </c:if>
                                    </td>
                                </tr>

                            </l:iterate>
                            <%--</c:if>--%>



                            <%--<c:if test="${param['method'] == 'showUpdateMeetingForm'}">
                                <l:iterate id="actions" name="MeetingBean" property="actions">
                                    <tr>


                                        <td>
                                            <h:text name="actions" property="actionText"/>
                                        </td>
                                        <td>
                                            <h:text name="actions" property="name"/>
                                        </td>
                                        <td>
                                            <h:select name="actions" property="status" indexed="true">
                                                <h:option value="FINISHED"><b:message key="actions_finished" /></h:option>
                                                <h:option value="PENDING"><b:message key="actions_pending" /></h:option>
                                            </h:select>

                                        </td>
                                        <td>
                                            <h:text name="actions" property="dueDate" />
                                        </td>
                                    </tr>
                                </l:iterate>
                            </c:if>--%>
                        </table>
                        </div>
                        <a href="javascript:openInNewWindow('dispatch.do?method=showCreateActionsForm');"><b:message key="meetings_action_add"/></a>
                        <!-- actions end -->




                    </td>
                </tr>
                <tr style="border-bottom-color:black; border-bottom-style:solid;">
                    <td><b:message key="gen_note"/></td>
                    <td><h:textarea cols="100" rows="10" property="note"/></td>
                </tr>
                <tr class="red1">
                    <td><span class="title"><b:message key="meetings_files"/></span></td>
                    <td></td>
                </tr>

                <c:if test="${param['method'] == 'showUpdateMeetingForm'}">
                    <tr  >
                        <td><b:message key="meetings_files"/></td>
                        <td><l:iterate id="doc" name="MEETING_PROCESS" property="documentCollection">

                                <h:multibox property="selectedDocuments">
                                    ${doc.documentPK.id}
                                </h:multibox>
                                ${doc.fileName} ${doc.name} ${doc.note}<a href="doc_download?did=${doc.documentPK.id}&mid=${doc.documentPK.meeting}">Download</a>
                                <br/>

                            </l:iterate>
                            <br>

                            <l:notEmpty name="MEETING_PROCESS" property="documentCollection">
                                <h:submit property="operation"><b:message key="meetings_remove_doc" /></h:submit>

                            </l:notEmpty>

                            <l:empty name="MEETING_PROCESS" property="documentCollection">
                                <b:message key="meetings_no_docs"/>
                            </l:empty>

                        </td>
                    </tr>
                </c:if>
                <tr  style="border-bottom-color:black; border-bottom-style:solid;">
                    <td><b:message key="meetings_files_adding_title"/></td>
                    <td><div id="file1"><p><b:message key="meetings_files_name"/> <h:text property="doc1Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc1Note"/>
                                <h:file property="doc1file" />
                                <input name="addFile2" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file2');this.disabled=true;" type="button"></p></div>
                        <div id="file2"><p><b:message key="meetings_files_name"/> <h:text property="doc2Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc2Note"/>
                                <h:file property="doc2file" />
                                <input name="addFile3" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file3');this.disabled=true;" type="button"></p></div>
                        <div id="file3"><p><b:message key="meetings_files_name"/> <h:text property="doc3Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc3Note"/>
                                <h:file property="doc3file" />
                                <input name="addFile4" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file4');this.disabled=true;" type="button"></p></div>
                        <div id="file4"><p><b:message key="meetings_files_name"/> <h:text property="doc4Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc4Note"/>
                                <h:file property="doc4file" />
                                <input name="addFile5" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file5');this.disabled=true;" type="button"></p></div>
                        <div id="file5"><p><b:message key="meetings_files_name"/> <h:text property="doc5Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc5Note"/>
                                <h:file property="doc5file" />
                                <input name="addFile6" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file6');this.disabled=true;" type="button"></p></div>
                        <div id="file6"><p><b:message key="meetings_files_name"/> <h:text property="doc6Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc6Note"/>
                                <h:file property="doc6file" />
                                <input name="addFile7" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file7');this.disabled=true;" type="button"></p></div>
                        <div id="file7"><p><b:message key="meetings_files_name"/> <h:text property="doc7Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc7Note"/>
                                <h:file property="doc7file" />
                                <input name="addFile8" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file8');this.disabled=true;" type="button"></p></div>
                        <div id="file8"><p><b:message key="meetings_files_name"/> <h:text property="doc8Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc8Note"/>
                                <h:file property="doc8file" />
                                <input name="addFile9" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file9');this.disabled=true;" type="button"></p></div>
                        <div id="file9"><p><b:message key="meetings_files_name"/> <h:text property="doc9Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc9Note"/>
                                <h:file property="doc9file" />
                                <input name="addFile10" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file10');this.disabled=true;" type="button"></p></div>
                        <div id="file10"><p><b:message key="meetings_files_name"/> <h:text property="doc10Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc10Note"/>
                                <h:file property="doc10file" />
                                <input name="addFile11" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file11');this.disabled=true;" type="button"></p></div>
                        <div id="file11"><p><b:message key="meetings_files_name"/> <h:text property="doc11Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc11Note"/>
                                <h:file property="doc11file" />
                                <input name="addFile12" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file12');this.disabled=true;" type="button"></p></div>
                        <div id="file12"><p><b:message key="meetings_files_name"/> <h:text property="doc12Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc12Note"/>
                                <h:file property="doc12file" />
                                <input name="addFile13" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file13');this.disabled=true;" type="button"></p></div>
                        <div id="file13"><p><b:message key="meetings_files_name"/> <h:text property="doc13Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc13Note"/>
                                <h:file property="doc13file" />
                                <input name="addFile14" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file14');this.disabled=true;" type="button"></p></div>
                        <div id="file14"><p><b:message key="meetings_files_name"/> <h:text property="doc14Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc14Note"/>
                                <h:file property="doc14file" />
                                <input name="addFile15" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file15');this.disabled=true;" type="button"></p></div>
                        <div id="file15"><p><b:message key="meetings_files_name"/> <h:text property="doc15Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc15Note"/>
                                <h:file property="doc15file" />
                                <input name="addFile16" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file16');this.disabled=true;" type="button"></p></div>
                        <div id="file16"><p><b:message key="meetings_files_name"/> <h:text property="doc16Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc16Note"/>
                                <h:file property="doc16file" />
                                <input name="addFile17" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file17');this.disabled=true;" type="button"></p></div>
                        <div id="file17"><p><b:message key="meetings_files_name"/> <h:text property="doc17Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc17Note"/>
                                <h:file property="doc17file" />
                                <input name="addFile18" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file18');this.disabled=true;" type="button"></p></div>
                        <div id="file18"><p><b:message key="meetings_files_name"/> <h:text property="doc18Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc18Note"/>
                                <h:file property="doc18file" />
                                <input name="addFile19" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file19');this.disabled=true;" type="button"></p></div>
                        <div id="file19"><p><b:message key="meetings_files_name"/> <h:text property="doc19Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc19Note"/>
                                <h:file property="doc19file" />
                                <input name="addFile20" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file20');this.disabled=true;" type="button"></p></div>
                        <div id="file20"><p><b:message key="meetings_files_name"/> <h:text property="doc20Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc20Note"/>
                                <h:file property="doc20file" />
                                <input name="addFile21" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file21');this.disabled=true;" type="button"></p></div>
                        <div id="file21"><p><b:message key="meetings_files_name"/> <h:text property="doc21Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc21Note"/>
                                <h:file property="doc21file" />
                                <input name="addFile22" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file22');this.disabled=true;" type="button"></p></div>
                        <div id="file22"><p><b:message key="meetings_files_name"/> <h:text property="doc22Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc22Note"/>
                                <h:file property="doc22file" />
                                <input name="addFile23" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file23');this.disabled=true;" type="button"></p></div>
                        <div id="file23"><p><b:message key="meetings_files_name"/> <h:text property="doc23Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc23Note"/>
                                <h:file property="doc23file" />
                                <input name="addFile24" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file24');this.disabled=true;" type="button"></p></div>
                        <div id="file24"><p><b:message key="meetings_files_name"/> <h:text property="doc24Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc24Note"/>
                                <h:file property="doc24file" />
                                <input name="addFile25" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file25');this.disabled=true;" type="button"></p></div>
                        <div id="file25"><p><b:message key="meetings_files_name"/> <h:text property="doc25Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc25Note"/>
                                <h:file property="doc25file" />
                                <input name="addFile26" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file26');this.disabled=true;" type="button"></p></div>
                        <div id="file26"><p><b:message key="meetings_files_name"/> <h:text property="doc26Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc26Note"/>
                                <h:file property="doc26file" />
                                <input name="addFile27" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file27');this.disabled=true;" type="button"></p></div>
                        <div id="file27"><p><b:message key="meetings_files_name"/> <h:text property="doc27Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc27Note"/>
                                <h:file property="doc27file" />
                                <input name="addFile28" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file28');this.disabled=true;" type="button"></p></div>
                        <div id="file28"><p><b:message key="meetings_files_name"/> <h:text property="doc28Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc28Note"/>
                                <h:file property="doc28file" />
                                <input name="addFile29" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file29');this.disabled=true;" type="button"></p></div>
                        <div id="file29"><p><b:message key="meetings_files_name"/> <h:text property="doc29Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc29Note"/>
                                <h:file property="doc29file" />
                                <input name="addFile30" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file30');this.disabled=true;" type="button"></p></div>
                        <div id="file30"><p><b:message key="meetings_files_name"/> <h:text property="doc30Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc30Note"/>
                                <h:file property="doc30file" /></p></div>
                    </td>
                </tr>


            </table>
        </div>

        <script type="text/javascript">

            function checkDraft(){
                if(!document.MeetingBean.draft[0].checked){
                    return confirm('Save meeting to database permanently?/Da li zelis da snimis sastanak u bazu? Vise neces moci da ga menjas!');
                }
                return true;
            }

        </script>


        <h:checkbox property="draft"><span class="important"><b:message key="meetings_draft"/></span></h:checkbox>

        <!-- if user has a privilage to CREATE meetings -->
        <%
            
            if (privileges.contains(SecurityManager.CREATE_MEETING_PRIVILEGE)) {%>


        <c:if test="${param['method'] == 'showCreateMeetingForm'}">
            <h:submit property="operation"><b:message key="gen_create"/></h:submit>
        </c:if>


        <%}%>




        <!-- if user has a privilage to EDIT meetings -->
        <%

            if (privileges.contains(SecurityManager.EDIT_MEETING_PRIVILEGE)) {%>

        <!-- if user is owner of meeting entiry -->
        <c:if test="${(param['method'] == 'showUpdateMeetingForm')}">
            
                <h:submit property="operation"><b:message key="gen_update"/></h:submit>
            

        </c:if>


        <%}%>

        <h:cancel><b:message key="gen_cancel"/></h:cancel>





    </h:form>

</div>
